﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Data.SqlClient;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using JsalesModel;


namespace JSales.ModuleSystem
{
    /// <summary>
    /// 密码修改类
    /// </summary>
    class ChangePswdClass
    {
        /// <summary>
        /// 修改密码方法
        /// </summary>
        /// <param name="userid">用户ID</param>        
        /// <param name="newpassword">新密码</param>
        /// <returns>返回状态</returns>
        public bool Changepassword(long userid, string newpassword)
        {
            using (var dbcontext = new JYEntities())
            {
                TbUser user =
                    (from u in dbcontext.TbUsers
                     where u.UserID == userid
                     select u).FirstOrDefault();
                user.PSWD = newpassword;

                dbcontext.SaveChanges();
            }
            return true;
        }
    }
}
